Dynamic update query building