Your best bet would be to pump the entire piston out, pushing out the pad at the same time - especially if the pad is stuck. You will want to get everything cleaned-up and the pad needs to slide freely for the brake to work well/properly.
Keeping the caliper connected to the brake lines, but disconnected and the other half apart, pump the brake lever to cause the piston to extract and push the pad out. This will get messy as the piston gets ejected and the brake fluid dribbles out. However, getting the piston out is a good thing to be able to check it and the seal for damage and most important to clean everything up very well.
Another way to extract the piston and push the pad out, is to take the caliper apart and off the lines. Then you can try attaching an air compressor line to the hydraulic inlet to "pop" the piston out with air pressure. This can be dangerous as you have to wrap the parts being ejected in a rag and watch where you point the thing as it could fly out with some force (and also spray fluid). Maybe safer would be to use a grease gun and pump out the piston with grease. (Then you really need to clean the insides.)
Clean and make sure everything is spotless. Use brake cleaner fluid. Make sure the piston bore and the piston and particularly the seal groove is spotless. Clean off the brake pad and its housing chamber. Removing rust and crud with fine emery would be OK for the pad and its housing, but be careful on the piston and its cylinder - it should retain a mirror finish so use a scotch pad or something soft to scrub there if required. Use lots of brake cleaner fluid.
Reassembly of the clean and dry parts needs proper lubrication - and different lubricant for the different parts:
1. The piston is inserted with only clean, new brake fluid. Everything below the o-ring seal in the cylinder should be lubed ONLY with brake fluid. Push the piston into the cylinder until it bottoms out.
2. Smear a small film of dielectric grease around the top of the protruding or now flush end of the piston, along the rim where it meets the cylinder. Work some of this grease down into the walls of the cylinder around the top wall of the piston. (There isn't much of any clearance for anything here, but whatt you want to do is get a seal that moisture and air can't penetrate.)
3. There likely is a washer of nylon that sits on top of the piston, between it and the pad backing - "glue" that on with a bit of high-temp silicone.
4. Coat the back of the brake pad backing and the housing for it in the caliper, with a "sparing" amount of anti-seize compound - not too much, just enough to "paint" the surfaces. (You don't want excessive compound to dribble out onto the brake pad surface - its supposed to not be slippery.)
5. Re-assemble the caliper onto the fork, placing the inner pad into its housing after applying a dab of high-temp silicone to its backing. (The silicone theoretically will help to stick the pads to their respective parts of the housing and piston, so that they move as one, as well as providing some damping quality to eliminate vibration and squeal.)
6. Presumably (and ideally) the brake system will have been completely drained, so top it up with fresh, new fluid. DOT4 is now recommended, but the original spec of DOT3 is also good. Just don't mix the two - use exclusively one or the other.
7. Make certain that the pivot hinge is clean and lubricated. Also adjust the hinge pivot screw once the pads have been set. Pump and purge the entire system of air. These procedures and re-doing the master cylinder is covered elsewhere in this forum, and should also be addressed if you are already doing the above for the caliper and pads.
That's my experience and summary of research for what is required. Others may have different opinion from their own experiences, but this is what I've found to work very well for me.