Maybe something like this (this won't work on system tables, just user tables). This is from AdventureWorks sample db. Take a look at the last column in the image
declare @exec varchar(max)
declare @table sysname
declare @schema sysname
set @table = 'Employee'
set @schema = 'HumanResources'
SELECT @exec = REPLACE(REPLACE(REPLACE('select *, DataLen=@calc FROM [@schema].[@table]',
'@calc', dbo.GetDataLenList(@table)),
'@table', @table),
'@schema', @schema)
print @exec
exec (@exec)