It should stay put on its own, but for a more permanent solution, you can adhere the pipe insulation to the studs by using ...