You won't be able to change that behavior...on walks he smells other dog's scents. He's just marking his territory.
My female, Ramsey...marks. Lots of piddling outside at work. Reese...at almost 2...has never marked. Reggie is 8 months...he has marked practically since I got him at 3 months.
As long as they aren't marking inside MY house...I don't care what they do outside.