Drift the slide all the way out, and use a center punch to "dimple" the bottom of the dovetail, throwing up a bit of metal (it should look like tiny craters.)
Normally, when you drift the sight back in, it will stay in place after that. If you have more trouble, make sure the gun is properly zeroed, and use the center punch at the edge of the dovetail, against the center of sight base and make a small dimple extending into the sight base and the receiver metal.