We had this problem with Darby when we adopted her. She was afraid of men, the vet, loud trucks and any noise she couldn't figure out where it was coming from, baby gates, anything held in an outstretched arm, anything with a motor (toys, dremmel,etc.) and she would run and hide if I became frustrated with the kids and spoke to them in a stern tone.
Fast forward almost 2 years and she falls asleep when I dremmel her nails, love meeting new people, loves the baby gate because she knows when she hears it go up that the cat is coming in and she'll get sniff at him and now thinks everything held in an outstretched arm is a toy for her to play with. And, she loves the vet and knows right where he keeps the cookies.
It took about a full year to get her where she is today and it was well worth all of it to see her become the happy, wiggling boxer she was always meant to be.
There was no magic...just patience and reassurance and lots of walks in the park. I'd find men, explain the situation and ask them if I could just stand and talk to them for a bit while they totally ignored Darby. Once she wasn't reacting negatively to that, I'd give them a treat to offer her. Another thing that really helped is that our boston loves everyone and if I had them both out I'd tell people to ignore Darby until she approached them but they could love up Hurley as much as they wanted. That way she got to see that he was being rewarded for being sociable.
With the loud trucks we'd just find as many as we could and walk past them. Every now and then we'd luck out and find a utility or tow truck just running idle and we walk back and forth and back and forth over and over and over and I'd give her commands to get her focus off the truck and onto me.
Any objects she cowered from I'd just put on the ground in front of her and wait for her be curious and praise her when she investigated it.
The dremmel took the longest....I do Hurley's nails with the dremmel so I'd just let her watch from wherever she was comfortable. Once she saw that Hurley got treats during dremmel time, she'd come closer for a treat. Once she sat more focused on the treats then the dremmel, I'd ask her to lay down and touch it to just one toenail and give her a treat. After some time I could do the back feet but she was still not comfortable with the front ones. I literally worked them in one toe at a time.
The level of trust we have between us now is amazing. It takes time, but it is possible.