Spread a drop cloth in the repair area to catch debris.
Cut out loose and severely damaged drywall from around the pipe using a utility knife. The goal is to leave enough solid drywall to which the repair can adhere.
Stick self-adhesive drywall tape over the damaged area to form a webbing over exposed spaces. Use strips of tape slightly larger than the damaged area so that it covers the damage and sticks to solid drywall. The goal is to reconstruct the wall using the tape.
Fill a drywall pan halfway with joint compound. Spread joint compound over the taped area and a few inches onto solid drywall using a 6-inch drywall knife. Place a 1-inch-wide bead of joint compound on the edge of the knife, using the side of the pan to scrape off the excess. Use the drywall knife at a low angle to the surface to spread the joint compound, and more of an angle to remove excess compound. Create as smooth of a finish as you can. Let the joint compound dry for 24 hours.
Sand off high areas and imperfections using a drywall sanding sponge, and paint the drywall if desired.