Surgery can sometimes be used to treat esophageal cancer. The type you have depends on where the cancer is, how much it's spread, your overall health, and other factors.