Preface, I am not a vet, I am not medically trained in any way - so please seek the professional opinion of your vet.
I have been battling ulcers myself recently, and spent a significant amount of time trying to learn about them. Here's a very basic run down of my thoughts.
Ulcers need to be treated for 30 days otherwise you are just easing the symptoms and not actually fixing the ulcer. You also need to fix the conditions that have led to the ulcer being formed - stress, lack of forage, turnout etc.
Gastrogard is the treatment for ulcers. It's horribly expensive, about $38 a day for 30 days. It's also only available with a script from a vet. GastroGard® Paste - Equine Pharmacy from SmartPak Equine
Ulcergard is marketed for prevention not treatment. However it's supposedly has the same thing, you just need to give 4x the preventative dosage (= 1 tube daily). It costs the same, the only advantage is that it's available without a script. UlcerGard - Equine Ulcer & Gastric Health Supplements from SmartPak Equine
There are more affordable alternatives.
The key ingredient in both Gastro/ulcergard is omeprazole. They make it for horses where it is coated for better absorption, and that comes out at about $300. Comes in pill form or syringe. Abprazole - Omeprazole Granules | Prevention and Treatment of Equine Gastric Ulcers
However you can buy omeprazole over the counter for humans. The daily dosage (from what I read) is 4mg per 1kg weight of horse - which turns into rather a crazy amount of daily pills. Equate Delayed Release Tables 20Mg Acid Reducer Omeprazole, 28ct - Walmart.com
Ranitidine is a much more affordable med, again available over the counter. The med works in a slightly different way, but is still effective from what I have read.
Internet searches seem to recommend a daily dosage 3mg per 1lb of horse. Which comes out to about 20 pills a day = $1.50 per day. Equate Ranitidine Acid Reducer Medicine - Walmart.com