You dont, SQL will always assign the lowest free number from sys.databases to a newly created / attached database, so either another database was created and got DBID 6 so when you attached you got the max+1 DBID or DBID 5 was free so when you attached the database so SQL assigned it DBID 5