Depending on the species hornworms eat members of the nightshade family (notably tomato and tobacco plants). You might be able to get them to eat other plants, but its not a long term food for them.
As a special treat I buy hornworms when I buy crickets. I buy them 6 at a time and treat him with 2 per day for 3 days in a row. I put collard greens in the the horn worms for the 3 days. For 3 day timeframe, the collard greens work to keep they hydrated.