While I am not a professional trainer, I have worked with many horses over the years with this problem and I use a variation of what HighHopeFarm writes about, not my idea but one I found on the internet. When you ride back to the barn, have a place close to the barn, patch of grass of whatever, where you can really work the horse, then walk away and make the place away from the barn easy. Then repeat, again and again. Pressure on (not punishment, just pressure) at the barn, pressure off as you go away from the barn (i.e. trail, dressage arena, or wherever). Repeat as often as necessary, daily, as much as possible for however long it takes. Then dismount and loosen girth, far enuf from the barn so that horses feel a release of pressure.
Warwick Schiller is a good one on youtube who explains this well, and his specialty is problem horses of all breeds, including WB’s, TB’s, QH’s, or ponies. He is “western” but has a great feel for all horses. My background is dressage. I’ve seen this work many times.