To keep squirrels away from your pumpkins, you need to experiment with a number of options. Ultimately, the idea is to make the pumpkins unappetizing to the squirrels so they don't want to eat them.
Spray hairspray on the pumpkin
Hairspray is not only unappetizing, but it's also sticky, which squirrels don't like. If you spray your pumpkins with a good dose of hairspray, you not only keep squirrels away from your pumpkin, you add a nice shine to the pumpkins as well.
Use a repellent spray
You can either make a repellent spray yourself or purchase one from a home and garden store. Two popular squirrel repellents are peppermint and garlic. Mix peppermint and crushed garlic in a spray bottle with a bit of water, and let the mixture soak overnight. The next morning, spray your pumpkins with the mixture to encourage squirrels to stay away.
Rub pepper sauce on your pumpkins
Squirrels don't like spicy things, so rubbing a pepper sauce such as Tabasco on your pumpkins helps keep the squirrels from destroying them. You can also rub dried peppers, such as chipotle or cayenne pepper, on your pumpkins. This works just as well as a wet pepper sauce.