It's pretty easy.
CREATE FUNCTION MyFunction(@variableOne datatype)
RETURNS datatype
AS
BEGIN
-- put function logic here
RETURN @variable
END
Then to call the function, you would use it in any SQL statement. For example
SELECT FIELD1, MyFunction(FIELD2) as ALIAS
FROM SOMETABLE;
Hope this helps
Andy