Spaying or neutering can help reduce humping behavior in dogs, particularly if it's driven by sexual arousal. However, it should be noted that this may not completely stop the behavior, especially if other factors such as stress or attention-seeking are involved.