If I understand you correctly now, you want to retrieve detail of a profile id, but if the profile id is 2379, then show all profile id other than 2379, right? Then may be the following stored procedure will help, or you can adapt it:
CREATE PROCEDURE spGetProfile
(
@para int
)
AS
DECLARE @tmpType VARCHAR(15)
BEGIN
IF(@para = 2379)
BEGIN
SELECT * FROM tablename WHERE profileid <> @para
END
ELSE
BEGIN
SELECT * FROM tablename WHERE profileid = @para
END
END
then call this procedure like this:
EXEC dbo.spGetProfile @para = 2378;
or
EXEC dbo.spGetProfile @para = other profile id;