Same advice applies here as in any situation. Don’t do it; delegate this to an external identity provider if at all possible. That being said, if you absolutely have to, see the following articles (assuming .net here):
Ultimately, what you need to do is generate a random salt for each new user using RNGCryptoServiceProvider. With that salt, hash the password using Rfc2898DeriveBytes. Then store the hashed password, along with the salt in your database. Pay special attention to the slowEquals implementation!