The solution I provided does work, I've been using it for several years. However, you need to take certain precautions in the way the procedures are written:
1. Always begin each script with:
USE [DATABASE]
GO
2.Always follow with a statement to drop the prodecure if it already exists:
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fn_Get_List_ID]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[Fn_Get_List_ID]
GO
3. Consequence of 2, always use a CREATE instruction (never use ALTER):
CREATE FUNCTION [dbo].[Fn_Get_List_ID]
(
@RowID INT
)
RETURNS INT
4. See my first post for what concerns dependencies and the order in which the script files must be arranged.
Have a nice day!