A puppy following you around at your heels and insisting on being on your lap can be cute at first. Without establishing clear boundaries, this behavior can become ingrained in your pup, resulting in a "Velcro dog" who insists on your attention at all times.
How to Train a Dog Not to Be So Clingy
You're the Boss
Establish firm guidelines with your dog about when he gets affection. Allowing him to jump up on your lap anytime he likes or responding to his every whine with soothing sounds encourages neediness. If he jumps up on your lap uninvited, calmly tell him "off." You may need to lift him down the first few times. When he is ready to jump up again, tell him "no." If you like your dog approaching you when he wants a pet, teach him to sit at your feet and wait. Don't pet him until he is sitting calmly; giving him attention when he's jumping on you excitedly encourages that behavior.
It's OK to Be Alone
From the time your pup comes home, he should learn it's OK to be alone. Training a dog to sleep in a crate provides him with a den-like experience where he can relax. Don't use the crate as punishment, but create a pleasant experience. Leave the crate door open and sit next to the crate while putting small treats inside and giving a command such as "in" or "crate." You also can feed him in the crate to create a pleasant association. Practice leaving him alone for short periods with the door closed while you move around the house. Work up to leaving him in the crate when you leave the house for short periods. Use a "this is normal" attitude and don't make a fuss over him when you leave or return.
The Away Command
If your dog stays pressed against your leg most of the time, you can discourage the behavior by making him move a short distance away. Claim your space by pointing and calmly telling him to go. Imagine you have an invisible bubble around you and you are pushing him away with the bubble as you point. Your dog will feel your energy and respond by moving away. Dog-friendly activities such as treats in puzzle balls will help him find alternate activity. Tell him "go" or "away" any time he moves into your space in a needy frame of mind.
Other Causes of Clinginess
A few dogs cling to their owners to protect them when they sense emotional distress brought on by illness or life changes. Dogs sensing their owner's weak energy may station themselves on their lap and growl or snap at anyone who approaches. Sending him a short distance away from you with the "away" command lets him know you don't need his protection and allows him to relax. Your older dog may become more clingy if he's developing health issues such as vision or hearing loss. If your dog's clinginess isn't due to health issues, you may want to work with a professional trainer to eliminate the issue.