Instructions
Fill a spray bottle with water, as soon as your dog tried to hump your leg, spray the dog directly in the face with the water. Firmly say "off". Use the word "off" whenever your dog jumps up.
Make a loud and startling noise as soon as your dog goes for your leg. One method for a loud noise is to fill a clean, empty can with 6 to 8 pennies, place tape over the opening and shake the can to startle your dog when he tries to hump. You can also try clapping loudly. Again tell him "off".
Push your dog off physically. Tell him off and command him to sit or lie down. Make him stay in this position for 10 seconds or so before allowing him to get up. This will show him you are in control, you are the dominant member of the house.
Have your dog neutered before he reaches puberty which is about 6 months of age. Even though leg humping isn't a sexually related behavior, neutering will help to curb leg humping before it becomes a habit. If your dog is older and has already developed the leg humping habit, neutering probably will not help.
How to Get Your Dog To Stop Humping Your Leg
A dog who humps your leg, your friend's leg or your family member's leg is very embarrassing. This can also be a dangerous behavior if your dog decides to hump a small child especially if you have a large breed dog. Leg humping is usually a sign of dominance. It is normal for puppies to hump each other, this will help them to determine pack order. When you bring a puppy or adult dog into your house, they need to become a member of your pack or family. You cannot allow them to become the alpha or leader in your home.