This is a display/report issue - it can and should be done in the report and not in SQL Server. Your example does not include all of the data elements needed which would be required for any solution.
What you have outlined is not possible in SQL - as you have different data elements in a single column. For example, you have PatientName and Drug Name in one column and there is no way to determine when it would display drug name as opposed to PatientName.
Problems are opportunities brilliantly disguised as insurmountable obstacles.
How to post questions to get better answers faster[/url]
Managing Transaction Logs[/url]