The first step is to find the nest where carpenter bees are residing and it is very easy to do so. You can look for holes in the exposed woods which can clearly predict the presence of the nests nearby.
You can make use of wasp spray or other types of bee sprays to kill the bees. Simply pour the spray in a pressurised can and then spray it inside the tunnels. You can also soak cotton and place it in the hole, which is another productive way of getting rid of carpenter bees.
You can also pour dust, insecticides, and wettable powders inside the tunnels leading to the nests. Amongst three of them, dust is a better option and is proven successful. You can make use of a flexible bottle with a nozzle to pour all of them inside the tunnels.
You can also fill the holes created by carpenter bees by making use of caulking compound, wooden dowel or plastic wood.
You can also paint the wooden surfaces to prevent any potential attacks of carpenter bees.