I need to execute the stored procedure within the function by sending only an ID that is the primary key to update a field in the table.
A bit of explanation is missing in a question, but a procedure within a function is not possible, it is a limitation of the engine and I think the end is not what you need, but a cursor, because you want to modify it for each id of a select but it does not work, but with a cursor it will be easier to update everything.
Sql server function is not the same as function in a programming language, in sql server is limiting and therefore procedures are used.