Replacing the pacemaker's pulse generator (which has the battery) is usually a simple outpatient procedure. That's because the surgery isn't done inside the chest cavity. The generator under your skin is replaced, but the leads, which are connected to your heart, are left in place.