In this case, you can create a FUNCTION that returns a string with the name of the colors passing the IDS you want, as follows.
create FUNCTION StringListToTexto
(
@List varchar(MAX)
)
RETURNS varchar(max)
AS
BEGIN
DECLARE @item varchar(800), @Pos int
SET @List = LTRIM(RTRIM(@List))+ ','
SET @Pos = CHARINDEX(',', @List, 1)
declare @texto varchar(max) = '';
---- sua tabela substituar por sua tabela
declare @tbl_coresAux TABLE (id INT, cor VARCHAR(50))
INSERT INTO @tbl_coresAux VALUES
(1 ,' azul'),
(2 ,' verde'),
(3 ,' amarelo'),
(4 ,' vermelho')
-----
WHILE @Pos > 0
BEGIN
SET @item = LTRIM(RTRIM(LEFT(@List, @Pos - 1)))
IF @item <> ''
BEGIN
declare @IdAux int = (CAST(@item AS int));
set @texto = @texto + (Select cor from @tbl_coresAux where id = @IdAux);
END
SET @List = RIGHT(@List, LEN(@List) - @Pos)
SET @Pos = CHARINDEX(',', @List, 1)
END
RETURN @texto
END
And you would call it the following way.
declare @tbl_cores TABLE (id INT, cor VARCHAR(50))
INSERT INTO @tbl_cores VALUES
(1 ,' azul'),
(2 ,' verde'),
(3 ,' amarelo'),
(4 ,' vermelho')
declare @tbl_mesa TABLE (id INT, cores VARCHAR(50))
INSERT INTO @tbl_mesa VALUES
(1 ,'2,4'),
(2 ,'1,3'),
(3 ,'2,3,4,1')
select id, ([dbo].[StringListToTexto] (cores)) from @tbl_mesa
where id = 2