When your dog is offering behavior that you do not like, try not to respond at all.
If at all possible, do not look at, speak to, or touch your dog. If possible, do not move at all and watch for a different behavior that is – perhaps only slightly – more acceptable. Click and treat the new, better choice that the dog is making. The goal is to help the dog understand which behaviors will pay off best. The ones that do not pay off will begin to be abandoned, especially when other behaviors do pay well.
Sometimes it will not be possible to ignore the unwanted behavior. In that case, plan ahead for the next time. Set up the situation so that it will not be possible for the dog to offer the unwanted behavior again. This will often require a change of routine, a new piece of equipment, a different setting, a change in the environment or anything that will prevent the dog from the ability or desire to offer the behavior again.
It is very important to do this planning, as it is very important that the dog not be allowed to practice the unwanted behavior and create a more established habit.