There are mods that can prevent NPCs from getting killed by vampire attacks:
This mod makes most NPCs hide indoors when there's a vampire (or dragon) attack, instead of facing them head-on and possibly getting killed.
A small mod that makes citizens in a village or city run indoors
during a dragon or vampire attack.
This was born out of frustration at seeing the citizens all trying to
be a hero and rushing headlong to their doom attacking dragons and
vampires. Instead, the citizens will run to safety like smart people
should when faced with the horrors of giant flying fire breathing
lizards (or bloodthirsty undead). NPCs who live in the attack location
who own a home there will retreat to it. If the attack location has an
inn, NPCs who don't live there will flee to the inn, along with any
NPCs who live outdoors. If no inn is present the game picks a random
interior from the surrounding area and those NPCs will flee there
instead.
This should work for any NPCs added by mods as well, up to a limit of
150 in the area. After that, they're on their own. The NPCs chosen are
first come, first serve by the game engine.
Guards, members of The Companions, Vigilants of Stendarr, and the
player's followers/teammates will not run, they will stand and fight.
Farm animals will not run either, because they're stupid. That
includes your horse.
[…]
Vampires will be detected when the events that spawn them begin
running.
Hate it when NPCs die from pesky dragon/vampire attacks? ...Well boy
have I got a mod for you. This mod saves your friendly neighbors from
untimely deaths. Technically, it flags certain NPCs Protected.
My mod protects:
- unique named NPCs
- all vanilla children
- named animals - all named dogs, the Stray Dog that can follow you, the goat Lucky from Dragon Bridge, Gleda the Goat, the fox Pumpkin
from Southfringe Sanctum, Frost, all Hearthfire pets, Bilgemuck, Old
Salty, Lord Tusk
- named creatures - Grok, Moira, Melka, Uderfrykte, Sinding (werewolf)
Allows you to customize the starting conditions for various quests. You can choose to delay the start of Dragonborn, Dawnguard, or Hearthfire quests, as well as other quest events. Or you can also reduce the level requirements allowing a quest to start earlier than it normally would.
[…]
Unlike the one-off quests, most of the reoccurring world encounters will allow you to adjust their settings at any time. This is the case with the Dawnguard Vampire attacks. Even if you've already begun the Dawnguard quest, you can stop further attacks by setting this value to something higher than your current level. However, I've also included settings to adjust the frequency of the random vampire attacks, which can also be used to prevent further attacks.
Dawnguard: You can stop random vampire attacks from decimating the population, or allow the crisis to build by increasing the difference between the level at which the vampire attacks start and when Dawnguard recruitment begins.
The Dawnguard DLC is great, but one thing I hate are it's relentless
vampire attacks that leave merchants dead in their wake. Once dead,
there's no replacing them, causing you to travel more or sell less.
Well, no more!
[…]
As your character levels up, the vampires, mages and dragons who
raid the towns get tougher, but they remain weak, making it
ridiculously difficult to keep them alive. This mod has three
solutions for this:
(1) It protects all merchants, so only you can kill them! When their
health drops to 1, they drop to one knee, and no further attacks will
harm them. But be careful, because your friendly fire can still kill
them. The exception to this are essential NPCs, who the game makes
invulnerable to keep quests from failing. The mod adds an asterisk
next to the name of each protected or essential merchant, to make it
easier to recognize them.
(2) It levels all merchants to a maximum level of at least three times
their starting level. So they'll level up some as your character
levels up, helping them stand their ground against the onslaught of
raiders and monsters.
(3) It levels all merchants who are potential followers to a maximum
of level 90, so they'll be more helpful as partners when your
character reaches higher levels.