Yes you can load master page dynamically.
In order to do so you need to assign a master page inside Page_PreInit Event.
Master Page dynamic assignment can only be done inside Page_PreInit Event, since the rendering of the page with the master page occurs prior to the Init event. However, in the case where you want to load the master page dynamically, for example from a database entry based on a user's preference or something, you don't want to add code to the OnPreInit event on every page in the site. It is easy enough to add that code to a base page class that you can inherit from for you pages in the site.
public class MyPage : System.Web.UI.Page
{
protected override void Page_PreInit(Object sender, EventArgs e)
{
string masterfile = GetMasterPageFromDatabase();
if (!masterfile.Equals(string.Empty))
{
base.MasterPageFile = masterfile;
}
base.OnPreInit(e);
}
}