The water hammer pressure wave travels too quickly for a conventional relief valve to open and release it. In addition, you have not posted enough information on the water hammer problem to fully understand the problem.
One option that may lessen the water hammer effects is the installation of a pump control if the water hammer transients are occurring during pump start up or shut down.
Link to Pump Control Valve
Another pump control valve is the Pressure Relief Valve. This is a fast opening, slow closing relief valve that provides system protection against high pressure surges on pump start up and pump shut down by dissipating the excess pressure to a safe location and dissipating the excess pressure to a safe location.
Pressure Relief
Another option that may help is with the installation of a silent check valves. Certain valves, such as swing check valves, tilting disc checks and double door check valves also can contribute to water hammer problems. These check valves are prone to slamming because they rely on reversing flow and backpressure to push the disc back onto the seat so that the valve closes. Silent check valves can be effective in reducing and sometimes eliminating water hammer.
Quick Closing Check Valve
The first thing you should do is to study causes, consequences and solutions before spending money on the problem.
Water hammer Article
There are also Pressure Relief Valves designed to maintain constant upstream pressure within close limits. In operation, the valve is actuated by line pressure through a pilot control system, opening fast to maintain steady line pressure but closing gradually to prevent surges