The most correct form are these (and they are valid for both the case you write about).
"Come si chiama?" ("lei" is simply implied)
"Lei come si chiama?"
"Come si chiama, Lei?"
"Come si chiama, lei?"
The upper case is used to make the written more formal.
Is it clear ?