That depends very much on the gun, I think. The current generation of gun CIWS like Phalanx and Goalkeeper only have an effective range of about 1.5 km, which gives them very little time to shoot down an incoming supersonic. Even if they hit it, the momentum might mean that the missile wreck ploughs into the ship. The 35mm Millennium ought to do a bit better than that for range, but it doesn't hit as hard.
The 76mm OTO firing DART guided anti-missile ammo is a possibility for the future because it will have a much longer range, although I would like to see it demonstrated first...
Tony Williams: Military gun and ammunition
website