Loop through all databases and remove all users
I am trying to create a process that will remove all users after the restore on the new servers as no user permissions will follow the database to the new server.


There is no need to delete all the users.

What you can do is use sp_help_revlogin to move all the logins that you are interested or your applicaiton/s need to the new server.

Once you move your database/s to the new server, you even dont have to sync up the users as the logins that you created from above script will be created with the SID from the old server.

As a side note, below script will help you fix the orphaned users:

WITH cte AS
(
SELECT dp.name AS DBUser, 
       dp.sid AS DBSid
  FROM sys.database_principals dp
       LEFT OUTER JOIN sys.server_principals sp 
         ON dp.sid = sp.sid 
 WHERE sp.sid IS NULL 
   AND dp.type = 'S'  -- SQL_USER
   AND dp.principal_id &gt; 4
)
-- join to logins with the same name to get the sql statement to un-orphan the user
SELECT cte.*, 
       sp.name, 
       -- generate the SQL script to un-orphan the users that can be.
       LinkOrphanUserToLoginSQL = N'ALTER USER [' + cte.DBUser + N'] WITH LOGIN=' + sp.name + N';'
  FROM cte
       -- LEFT JOIN allows seeing all orphaned users
       LEFT JOIN sys.server_principals sp  
         ON cte.DBUser = sp.name
        AND sp.type = 'S'
ORDER BY DBUser;