Usage of ExecSQL in UDF?
Not in a T-SQL function, but executing stored procedures can be done in SQLCLR functions.

An example of using a .NET / C# SQLCLR user-defined function to execute a stored procedure is shown in the following article (which I wrote):

Stairway to SQLCLR Level 2: Sample Stored Procedure and Function