You can buy devices that arrest the water hammer - they install on the water line - they have a piston inside that absorbs the pressure when a valve is shut off. They cost about $10.
I don't know why you have a problem all of a sudden. It would seem as if your water pressure has risen. Possibly due to a section of pipe being replaced? (A section that had restricted flow because of mineral buildup? A section that was changed from 1/2" to 3/4" or larger to accomodate the sprinkler system?)
Try to close valves slowly until you figure it out.