Your dog must be strong on his basic obedience training. He needs a solid sit, down, touch, stay, place, and especially “leave it”. When your dog’s ears perk up, you should immediately say “leave it”, walk away from the fence line 10 feet, saying the command “away” at the same time. You should have high-value treats in your hand all the time during these exercises. Once you are 10 feet away from the fence, use your clicker or say the marker word “yes!” and reward your pup. You will want to do this in different areas of the fence line and do it randomly. It is very important that during this training process you issue your commands before he goes into a full-blown, amped up fence run complete with barking. Eventually, perhaps after several weeks or several months, your pup will see a stimulus approach, and calmly walk away from the fence line looking for a treat. Make sure you are there to reward him some percentage of the time for at least a few more months. After that, reward him for making the right choices so he thinks in his head, “maybe my person will reward me this time.”