Yep, I have this problem, luckily I have come a long way in the past few years. It seems the more I am comfortable with myself the easier it is for me to "go".
I'd say find something that works and go with it. If I use a public bathroom, I will use the stall if there are others in the bathroom. If I have to wait until one comes free, oh well, I will. I cannot pee in a urinal if someone else is next to me or behind me, waiting. I have come to accept this. In stalls, I rarely have problems, even if there are others in the bathroom (unless it is a small bathroom, and there is no music - hate those ones!).
One trick I use to relax myself is to close my eyes and imagine that the other person(s) in the room are people I know and feel comfortable/safe with. I will actually visualize that this person is my mom, or this person is my brother, or this person is my good friend... and eventually I can go.
This topic reminds me of being 12 years old and on a 3 day school trip. There was only one bathroom for 20 boys and the urinal was a big stupid trough. What psycho invented the urine trough for humans!! I always wondered why boys were treated like animals at public btahrooms while girls always had stalls.
Anyway.. lol... for three days i could not go to the bathroom. Whern we got back to the school, I walked home... barely able to walk I was in so much pain. I must have had an angel look after me so I wouldn't get a bladder infection. I remember going pee when I got home, I peed for what seemed like hours and my stomach was in so much pain.
I didn't know that so many people struggled with this either... I have been teased about it in the past. i find it encouraging to know others have the same issues.. and we're ok!