I have corrected stored procedure syntactically. I have written comments for changes I have made. Correct sql will create SP for you.
CREATE PROCEDURE [dbo].[hrm_Languages]
(
@Name varchar(120),
@CreatedBy bigint=0,
@UpdatedBy bigint=0,
@IsDeleted bit=0, -- Insert comma
@StatementType Varchar(20), -- Add variable @StatementType
@ID int OUTPUT
)
AS
BEGIN
IF @StatementType = 'Insert'
BEGIN
-- As @ID will reset again after insertion of record so following two line are not needed
SELECT @ID = ISNULL(MAX(ID), 0) + 1
FROM [dbo].[Languages]
SELECT @Name
WHERE NOT EXISTS (SELECT ID,NAME FROM TableName -- What is table name for
WHERE NAME=@Name)
insert into [dbo].[Languages] (Name,CreatedOn,UpdatedOn,CreatedBy,UpdatedBy,IsDeleted)
values( @Name, SYSDATETIME(), SYSDATETIME(), @CreatedBy, @UpdatedBy,@IsDeleted)
-- SysDateTime is used to get current datetime
SELECT @ID = SCOPE_IDENTITY()
End
ELSE IF @StatementType = 'Select'
Begin
select * from [dbo].[Languages]
END
ELSE IF @StatementType = 'Update'
BEGIN
UPDATE [dbo].[Languages] SET
Name = @Name, UpdatedOn = SYSDATETIME()
WHERE ID = @ID
END
ELSE IF @StatementType = 'Delete'
BEGIN
DELETE FROM [dbo].[Languages] WHERE ID = @ID
END
END