We have to pass ApplicationName instead of ApplicationID.I modified the above code and corrected the Query....
Declare @UserName NVarChar(255)
Declare @NewPassword NVarChar(255)
Declare @PasswordSalt NVarChar(128)
Declare @Application NVarChar(255)
-- Enter the user name and new password between ''
-- do not leave any spaces unless intended to do so.
-- Edit only between single quote characters
Set @UserName = 'admin' -- This is a default DNN admin user; the default host user is 'host'
Set @NewPassword = 'newpassword' -- Your new password
SET @APPLICATION = (SELECT [APPLICATIONNAME] FROM ASPNET_USERS U,ASPNET_APPLICATIONS A WHERE U.APPLICATIONID = A.APPLICATIONID AND USERNAME=@USERNAME)
Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE UserName=@UserName))
Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5