First thing is to teach him an alternate behaviour, so he has another option: the goal here is not to prevent any behaviour, but to help the dog deal with his anxiety.
This behaviour can be a simple "sit" or a "go to your place". Once you trained that, then you have to help him do that instead of spinning.
If you can "trigger" the behaviour with, say, a light noise, do it, then ask the dog to sit (if you choose the sit option) and positively reinforce that (ie. with treats, his toy, whatever he finds rewarding). Do it multiple time, possibly increasing the noise, but avoid scaring him (ie. progress in a lot of small steps).
The dog will learn that this is the appropriate reinforced behaviour. At the same time, as it is an anxiety issue, stay calm and do not try to confort it while (or before) he spins (which would be reinforcing the spinning).
Another way to deal with such behaviour (this one is not addressing the anxiety issue though) is to put it under stimulus control. A behaviour which is under stimulus control will eventually happen only when cued and won't happen when it is not cued. That is : teach your dog to spin when you say spin. (quickly: lure it into a spin when he's not anxious, treat, then add the cue (for my dog if have "spin" for a clockwise spin and "twist" for an anti-clockwise spin), then practice in difference situations).