The best way to do so is to smear or spray the bark with a mixture of water and soap. It creates a slippery surface that caterpillars cannot cling to, causing them to fall every time they try. Don’t use any unproven pesticides to the bark since it can harm the tree.