Cursors versus Set-Based Operations

Hello.

I need some help. I need to convert this code with cursors to set-based operations. I can't understand how I can make the set-based code do the same as with cursors.

DECLARE Cursor static local FOR
SELECT Cid,Abrev FROM EntityType
OPEN Cur
FETCH NEXT FROM Cur INTO @entityType, @entityTypeAbrev
WHILE @@FETCH_STATUS = 0
BEGIN

SET @CurEnt = Cursor static local FOR
SELECT did FROM Entity where EntityTypeCid=@entityType
OPEN @CurEnt
FETCH NEXT FROM @CurEnt INTO @entityId
	WHILE @@FETCH_STATUS = 0
	BEGIN

		SET @RandNumber= FLOOR(RAND()*(28-1)+1);
	
		select @entityNumber=EntityNumber from Entity 
		where did=@entityId
		--print @entityNumber

		SET @FullName= @entityTypeAbrev + ' ' + cast(@entityNumber as nvarchar)
		SET @ShortName = @FullName 
		/* 
		* ENTITY*/
	
		UPDATE entity set fullname=@FullName, ShortName=@ShortName where did=@entityId
	
		UPDATE Agenda set EntityName= @FullName where EntityDid=@entityId 

--Intervetions
SET @CurIntervs = Cursor static local FOR
select did, CredOperIntervType from CredOperInterv where EntityDid=@entityId
OPEN @CurIntervs
FETCH NEXT FROM @CurIntervs INTO @credOperIntervDid, @credOperIntervTypeId
WHILE @@FETCH_STATUS = 0
BEGIN

Thanks in advance
Paulo Dias

without any ddl or sample data, you can try this. Not sure what the @CurIntervs cursor is doing

		update e
		   set e.fullname=concat(et.entityTypeAbrev,' ',e.EntityNumber)
			   e.ShortName=concat(et.entityTypeAbrev,' ',e.EntityNumber)
	     from Entity e
			join EntityType et
				on e.did = et.EntityID
				
		update a
		   set a.EntityName = e.fullName
	     from Entity e
			join Agenda a
				on e.entityID = a.EntityDid