Hashes a password and compares the hash to the hash of an existing password. PWDCOMPARE can be used to search for blank SQL Server login passwords or common weak passwords.
A. Identifying logins that have no passwords
The following example identifies SQL Server logins that have no passwords.
SELECT name FROM sys.sql_logins WHERE PWDCOMPARE('', password_hash) = 1 ;
B. Searching for common passwords
To search for common passwords that you want to identify and change, specify the password as the first parameter. For example, execute the following statement to search for a password specified as password.
SELECT name FROM sys.sql_logins WHERE PWDCOMPARE('password', password_hash) = 1 ;