Would that transfer the passwords for sql account?
Yes - it creates the new login with the same password and the same SID. Because the SID is the same - it ties to the user in the database without having to execute sp_change_users_login (no orphans).
But - this does not do anything for server level permissions, which you will either have to manually recreate or find a script that identifies those for you. You could also build your own script using the tables sys.server_role_members and sys.server_principals.
Or - you can look at dbatools and use their powershell functions (https://docs.dbatools.io/#Copy-DbaLogin).