If your dog only steals food during your mealtimes, find a treat he/she really likes (cheese, peanut butter or cut-up hot dogs). Stuff that food into a hollow bone or Kong toy and give the dog the treat on his blanket, and only when you're eating. Be consistent. The dog will soon learn that if he goes to his place, he'll get a terrific treat.
Try sprinkling some lime juice or bitter apple onto a sandwich and leave it near the edge of a table. Once a dog gets a taste of that sour meal, he will learn to leave people food alone.
Set the dog up to get caught. Put your dog on leash when it is likely to steal food. As the dog takes the bait, offer a corrective jerk immediately and firmly say "No!" Once you have used the corrective jerk satisfactorily, place a bonker (a towel rolled up like a newspaper and tied with string) in locations where the stealing is likely to take place. Throw the bonker at the dog say "No." Use a gentle tone with a shy dog and a firmer tone with a stubborn dog. Once the correction is made, offer lots of praise to your dog for obeying you. If you are not opposed to using a remote training collar that can administer a small electrical correction via a remote control device, this is one of the few behaviors that a remote collar works well with because the dog will think the correction is coming from the behavior rather than you. Consult a qualified trainer or behaviorist for proper usage.
With taller dogs whose front paws can reach the counter tops, try putting double-sided tape on the edge of the counter tops. Most dogs will not like the sticky sensation on their paws and will stop jumping up to avoid the stickiness.
Booby-trap the counter or tabletop - Check out products designed specifically designed to keep your pet off those areas. One possibility is a vinyl mat, such as a Scat Mat, that let you position the mat wherever you want to make a spot off-limits to your pet. When the mat is plugged in, it emits a weak electrical impulse, similar to a static charge. When you pet steps on the mat, he/she will get an unpleasant, but harmless shock. These devices run about $100, but you can move them from place to place as your needs change.