When it comes to deterring garden damaging insects, we can employ chemical agents, we can employ companion plants, or we can invite predatory critters. By chemical agents, I do not mean just the commercially produced poisons (which I avoid) but things like Neem oil and pepper spray made from my jalapeno and cayenne cast-offs.
This year I companion planted borage with my tomatoes. That worked exceptionally well. My only mistake was in planting them at the same time: I should have given the tomatoes a month’s head start. By the time the tomatoes were bearing ripe fruit, the borage was dying off. Shortly after it was gone, the hornworms started appearing. But I still had help.
When I find a hornworm that is covered by white cases, I either leave it be or move it to a sacrificial tomato plant so the pupae it carries will mature and hatch. These are pupae cases of the Brachonid Wasp: a small, non-stinging, parasitic wasp that favors hornworms as the preferred meal for its young. The female Brachonid deposits its eggs just under the skin of the hornworm. When they hatch the larvae chew their way out (feeding on the worm as they go) and spin those white pupae cases. By the time you see those, especially if there are lots of them, the hornworm is in a weakened state. Many that I find in this condition will do little more damage, some never move from that spot.