Hi,
Yes, if your computer came with genuine Windows 8.1. You should be able to reinstall Windows 8.1 on a new HDD in your computer and it should auto activate.
In the situation that it doesn't auto activate, you can phone Microsoft and tell them the situation and they will help you activate.
Hope this helps you,