Summarize this article:

Stomach discomfort, including ulcers, may contribute to some horses' desire to crib. By switching to a diet that helps reduce ulcers, such as alfalfa hay, you may help eliminate stomach problems, which in turn,  may reduce the horse's cribbing. If your horse is already on alfalfa, you may want to try other options for reducing cribbing.  Change your horse's diet over slowly. Begin mixing some of the new diet in with the old a little at a time, gradually adding more each day. That will help reduce digestive issues. If you suspect that ulcers are causing your horse's cribbing, it's best to get your veterinarian to do a scope of its stomach to get a proper diagnosis. If ulcers are present, your vet can provide you with treatment options and ways to manage the ulcers, which will help heal your horse and reduce the cribbing. Sugary feeds may encourage your horse to crib more, so opt for a low-sugar version, like plain oats, when you're feeding grains in addition to hay. It may be that sugar lights up the same reward center in the brain that cribbing does, so when your horse gets sugar, it may want to keep the feeling going. Look for feeds that have a higher percentage of fat and fiber rather than starch and sugar. You can also try giving the horse hay before you feed it grain, which may cut down on cribbing, as well. If a horse has something to keep its mouth occupied, namely hay or a large pasture for grazing, it's less likely to crib. By having hay around, you encourage the horse to nibble on the hay throughout the day instead of inappropriate things like your barn or your fences. If your horse has trouble with overeating, try a slow feeder. These feeders give your horse a little bit of hay at a time, slowing down how much it can take, but your horse will still be nibbling most of the time. Because stomach discomfort may contribute to cribbing, have your horse seen by the vet if you haven't already. That way, the vet can rule out any stomach problems, such as ulcers or other intestinal issues, that you'll want to get taken care of.  Your vet may suggest an antacid for certain conditions. If your horse doesn't have a stomach problem and cribbing has been a chronic problem, your vet may suggest having surgery to help prevent cribbing.

Summary:
Feed the horse alfalfa hay to prevent ulcers. Avoid grain feeds that are high in sugar. Provide hay at all times to keep your horse occupied. Ask your veterinarian to see if there's an underlying reason your horse cribs.