I wanted to get Xanax for my dog's fireworks phobia but all the vets I went to didn't carry it. They prescribed us acepromazine, which is the traditional remedy that vets prescribe for fireworks/thunderstorm phobias, BUT new studies have shown that this drug (which is just a sedative, NOT an anti-anxiety med like Xanax) can actually worsen noise phobias.
You can buy CDs of thunderstorm sounds and gradually desensitize your dog to it by playing the CD's on a very low volume for long period of time and then, over many sessions/days/weeks, gradually make it louder and louder.
You can also try to lessen or muffle the noise by closing all windows and doors and turning on the TV or radio to a loud volume to create a loud background noise to drown out some of the sounds of the thunderstorm or to at least make the thunderstorm/fireworks sound less of a huge contrast.
Also don't soothe the dog when they are afraid, either ignore the dog or act nonchalant and normal even though it's hard to do that when you see your dog cowering under the table or in a state of learned helplessness. (after seeing my dog practically shutting down from terror, poor thing, the next time round I went ahead and gave him the acepromazine despite the new warnings about it possibly worsening phobias. Our vet didn't believe the warnings and still recommended it. In our case it helped him get though a night of fireworks because we also had tired him out during the day.)
I've also read that other studies showed that some dogs who have thunderstorm/fireworks phobias do better if they are around other dogs who don't have those phobias. Somehow, even if we are acting normal and nonchalant, it doesn't help as much as if other dogs are being normal and nonchalant. I don't know why.
You can also try the DAP sprays that are supposed to help calm dogs down, or try Rescue Remedy. I've been told they work on some dogs but have little effect on others. I have not tried either of these yet but I will the next fourth of July!!