i have HAD exactly the same problem but I am mostly over it now.
mine all started 10 years ago when i was on a trip on a bus and I had to make the bus pull over as i needed the loo so badly that i nearly wet myself. for quite a while after that i was almost neurotic about going to the loo and would get very worried if i was out of site of a toilet.
there is hope though and you WILL get over this.
i went to see a psychologist\hypnotherapist who basically said that I have a tendancy to be obsessive. are you the type of person who gets hooked onto something easily? this is not a bad thing! being obsessive helped me learn guitar, got me through some projects and has helped me achieve a lot. many of the greatest minds in the world are obsessives so don't change that part of your personality.
now here are a few methods i used to get over the feeling:
1: If you are a guy, get an erection. I know it sounds strange but it does take away the sensation of needing to urinate. Now its not exactly the easiest thing to do when you are worried about needing a pee, but it does work!
2: Push on your bladder when you get this urge. This will tell you if you really need the loo or not. If you get no strong sensation of needing to pee when you push on your bladder then you don't need to go and there is no way you will wet yourself. I found this the best method. By realising you are truly empty you can just ignore the urge to pee, and over time you will start to forget about the issue.
3: It is fine to have a few crutches. I always have a pee before leaving the house, going on a car trip, whatever. That way i know i am empty.
4: Finally if you have never actually wet yourself, then you know that you don't have a real problem and it is all in your head. Relax, breath deeply and you WILL get over this. Trust me, because I have had exactly the same probelm and I got over it!
Good luck!