He is not a young bratty immature male waiting to grow up thinking he is all that and more, he is 7 years old which makes me think this behaviour is now a learned behaviour.
If he were mine, I would not put him in a sit and give commands to leave it while another dog walks by, I would keep moving and distract him. Sometimes you need to find a different way to help your dog unlearn inappropriate behaviours rather than barking commands at him or severely yanking on his check chain or prong collar! If you see another dog approaching - keep walking, pick up your pace, put more space between yourselves and learn to have him focus on you by teaching him the look or watch command. Or change directions and continue your walk in another direction - try to set him up with more successes than failures to increase his confidence.
Keep distance between him and other dogs, have him learn to focus on you and keep moving.