Shout at the top of your voice how discusted you are with the dog, be very agresive with your words.
Get very angry with the dog and then slow down and gently tell the dog, you have let me down.
If it's not on the lead, put the lead on and just walk for a while don't stop don't speak.
After a few minits let the dog off again, if you see it going near poo shout and repeat.
Never hit the dog, just sound agresive, it will take time but has always worked for me.
It's all about you being the pack leader.
Good luck.