In it's simplest terms you can just do
select Id, max(createddt), max(createdby), max(modifideby), max(modifydt)
from tablename
group by Id
which will give you the results you expect. Note that
MAX[
^] ignores NULL values.
I suspect there is more to your requirement however - is your course work to do with PIVOT? If so then read this article
Simple Way To Use Pivot In SQL Query[
^]