The properties function of MATLAB dynamicprops handle classes is not returned in sorted order, and isn't even self-consistent. Multiple class initializations followed by clear classes can return different orders each time. Since R2018b (and maybe earlier) one can do the following to return properties in sorted order.
Add public overrides for properties and fieldnames like below. Technically properties() isn't a method of handle dynamicprops, but this should still work because methods are called before built-ins (https://www.mathworks.com/help/matlab/matlab_prog/function-precedence-order.html).
function value = properties( obj )
if nargout == 0
disp( builtin( "properties", obj ) );
else
value = sort( builtin( "properties", obj ) );