You have an Out Of The Box behaviour that must be activated in the Welcome.ascx inside {SharePointRoot}\Template\CONTROLTEMPLATES folder.
Localize this code in Welcome.ascx
<SharePoint:MenuItemTemplate runat="server" id="ID_RequestAccess"
Text="<%$Resources:wss,personalactions_requestaccess%>"
Description="<%$Resources:wss,personalactions_requestaccessdescription%>"
MenuGroupId="100"
UseShortId="true"
Sequence="300"
/>
Under this code paste this other
<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
MenuGroupId="100"
Sequence="100"
UseShortId="true" />
Now, you should have the Sign in as different user option.