Carpenter bees provide the invaluable service of pollinating plants; but the bees can cause damage to your home or deck. To prevent them from drilling holes into your home (they do this to rear their young), apply a thick coat of low- or no-VOC paint or varnish to wood that's exposed to the outdoors, including windowsills and eaves; this makes the wood less appealing to the bees.
If you're already noticing holes in a piece of wood, you can remove that piece and replace it with painted or varnished wood, or else stuff steel wool into the holes (after the bees have emerged in the spring). There's no need to be afraid of them. Males—the ones you generally see buzzing around your head—don't sting, and the females rarely do.
According to Maryann Frazier, a honeybee extension associate at Pennsylvania State University, you can kill the larvae or pupa by inserting a hanger into a carpenter bee hole and ramming it around, and then sealing the hole. This should be done in late summer or early fall. The technique isn't perfect, though. "Sometimes, they make galleries [holes] that aren't just linear, but shoot off on sides," Frazier explains. "So you can't get them all if they go off at an angle."