Open the sliding door until you can easily access both the inside and the outside of the lock.
Look at the inside portion of the handle and locate the two screws that hold it in place. One screw is at the top of the lock and the other screw is at the bottom of the lock. Remove each screw using a screwdriver by turning them counterclockwise.
Grasp one side of the lock and pull it away from the door, using a flat head screwdriver to pry it up if needed. Then push the other side of the lock out from the door.
Look at the back of the old lock and locate the silver hook at the bottom called teeth. Compare it to the new lock to ensure they are the same size. Most new sliding door locks come with multiple teeth so you can change it if needed. To change the teeth, remove the screw that holds it in place, pull the old one off and push the new one on before reinserting the screw.
Insert the back of the new lock into the outside of the door and insert the front of the new lock, with the teeth, into the inside of the door. Make sure the teeth are facing toward the door jam when you insert the lock.
Insert the two screws, provided with the new lock, into the screw holes and tighten them using a screwdriver.