Hi,
Styes result from oil glands of the eyelids. Unfortunately, there are no proven methods on how to prevent recurring styes.
For some people, the recurrence may be associated with certain high sugar diet/ high fat content food. Therefore, by making some changes to their diets, some patients may find that their condition can be improved. Also, keeping your eyelid hygiene is important; I would recommend patients to use eyelid wipes which are available over-the-counter. Ceasing contact lens wear could also help in some cases.
Generally, there are no foolproof method to prevent styes from occuring. However, I would advise you to visit to your opthahlmologist if necessary as he will be able to prescribe some medications to reduce the incident of recurrence.
I hope that this has helped you!