Sphere decoding (SD) based detection schemes for sparse code multiple access (SCMA) systems have recently received attention due to their promising features. However, the existing SD-based schemes can only be applied to SCMA systems with constellations that possess a certain structure. In this paper, we propose a novel SD-based detection scheme, namely improved SD (ISD), for SCMA that achieves the optimal maximum likelihood detector for any arbitrary regular or irregular constellations. To overcome the rank deficiency problem of the SCMA channel matrix, we fix a portion of the transmitted symbols and obtain an optimal detection problem that is equivalent to the original SCMA detection problem for all types of constellations. Moreover, due to the sparse nature of SCMA, the partial metric at each layer is evaluated in such a way that is independent of users assigned to each resource element. This, in turn, reduces the average complexity of ISD.