It depends on the species. Each butterfly species has its own set of preferred host plants; some are pretty picky, others less so. As a rule, butterflies lay their eggs on their caterpillars' food plants and the caterpillars then spin their cocoons (not "cacoons") on the same plants, though many drop to the ground and pupate there, especially if they'll be there all winter.
If you want more information on specific species, you might check out the site below.

