would Sacred Flame hurt a person the target is holding as hostage/human shield?

An enemy had grabbed a friendly NPC and was using him as a hostage and standing behind him as cover. The (new) DM seemed to be implying that the archers in our party would risk shooting the friendly. I thought sacred flame would be good because it can target creatures in cover and seems to go through environment without damaging anything else. So we reasoned sacrad flame would just fry the enemy and leave our friendly unharmed. Thoughts?