It should stay put on its own, but for a more permanent solution, you can adhere the pipe insulation to the studs by using the self-sealing adhesive or by pounding in a couple of nails.