Try --- the words -- "Leave him" & get your dog to look at you, give a treat. Make sure your dog is leashed. Start doing this with object such as their ball, or a treat saying -- "Leave it and when they look away say OK - take it so they learn the word Leave it
When you are walking and a little dog comes by (hopefully leashed) - say Leave him, say good-by and turn your dog in another direction away to change his thought. My is hard at that part, so I keep working and just walk and sometimes yes - pull the other way away from the yapping dog
Try training classes with a small group of dogs at a great place. Maybe ask a Rescue group in your area to recommend one. Good luck