Train your puppy to accept unusual noises and other “scary” loud sounds. Distract with toys and reward good and calm behaviour. Give them time, wait for your puppy to settle down. 

For outside noises like fireworks or thunderstorms you can try to socialise them to noises as long as it is well away from the busy firework period. Using a Sounds CD (available online) and desensitisation programme you can help them get used to the loud noises way before they happen, so they’re never scary. 
Make sure to introduce your puppy to the recordings of the noises gradually and during a time where there are not natural thunderstorms or fireworks usually. Exposing your dog to sounds of fireworks, rain, gunshots, thunder and much more can ensure they will not be frightened or shocked when they do occur or if they suddenly happen. Even if they hear it when they are older, they will be more prepared for it and it will be a normal noise that they heard when they were puppies and had no reaction then so have no need to react now.
Start super quiet really just at the volume they barely hear it. Day after day, increase the volume gradually and stop increasing the volume if they seem to react badly to it. Reward your dog when they respond well, calmly or have no response at all. It is good to play these recordings when your dog is in a calm state anyway. This process can take quite a long time, so it is better to do it long before or after the firework season and stay positive and be patient. 
If there is a sudden episode of thunder or fireworks to mask the noise by closing curtains and turning the TV/radio on and distract them with treats and toys. 
Try not to give them too much attention or reassurance as you could accidentally be rewarding their fearful reactions. Especially if your pup is hiding or trying to find their own space, then ensure that they have that and try not to pursue them too much. 
Ensure that they have their own space that they can go to, such as a safe haven or crate, full of bedding and blankets that is always available to them. You can leave food puzzles, toys or treats here so they know it is a comfy safe place to be and cover it with a blanket, not only so they feel secure but also this can help stop the lights of the thunderstorms/fireworks, which can often be enough to startle puppies or to start a fearful reaction. 
Know that your presence itself will be soothing and comforting, so just being nearby is enough. But never leave them during this period, be a friend by being in the same room or fairly close. 
Try to also avoid going on dog walks around this time or in the evenings, keep it during the day and have lots of playtime and fun to expel energy together in the evenings.