With your dog sitting at your side, set off and give the command “heel” (so that your dog is aware you are about to move). If the dog gets ahead, stop and encourage it back to your side with a titbit. Repeat. To begin with, stop every three to four paces to praise your dog and give a titbit. Do not use your voice unless your dog is at your side. You can also practise this off-lead in a secure area – this makes you work really hard at keeping your dog with you, rather than relying on the lead.
The process is the exactly same for older dogs as it is for puppies; prevent accidents from happening by using baby gates and a crate if possible, create a predictable schedule, learn to recognize your dog’s potty signals, accompany your dog outside and immediately reward for all outdoor elimination, properly clean any accidents and supervise your dog until you’re sure that he understands the rules.