I will go into the stall, with my back to the door, take my pants down, remove the old, bring the new up between my legs, close my legs to hold it somewhat and then affix the tapes. Having your back to the door helps hold it shut, and it provides a little more space to work than being over the toilet.
I always rather do it in a single person room, but sometimes you just have to use a stall and it can be a challenge. One other thing I have is a hook inside of my backpack. I can take that and attach it to the backpack top and then put it over the stall wall. This provides me a place to hold things while I do my business.
If you feel comfortable, you can always speak privately with HR to see if you can make special adjustments within your working space to help you.