The best cure for banging water pipes is a water hammer arrester with a lubricated internal piston. The sealed piston works better than capped pipes, which eventually fill with water.