Hi AdnanT ,
Welcome to Microsoft Q&A platform and thanks for posting your query here.
It seems you are trying to perform dynamic mapping in dataflow but it is not working giving empty schema in the output.
The official documentation tutorial which you have shared is suggesting to use cached sink. Could you please confirm if sink2 in your solution is cached sink ?
Since you are getting empty schema in output, kindly check if there are any null values in the source data. If there are null values, try replacing them with default values or removing them.
You can try using map drifted option in data preview tab and manually map the non-drifted columns once.
Hope that helps . Kindly let us know how it goes. Thankyou