Dogs mostly do what they think you WANT them to do. They really want to please you. They think they are protecting you when they are aggressive to other dogs.
I don't have a great answer but you may try walking your dog on a leash and carry a small spray bottle of water. When your dog acts aggressively towards another dog say NO very loudly and give it a short spray of water. Do this every time the dog is aggressive.
When the dog is "good" hand it a treat or pat the dog and praise it in a cheerful voice... the old "GOOD dog" thingee.