You can use data mining or machine learning services (Phython and R) to create K-Means Clustering model.
Please refer to the following articles which might help:
Microsoft Clustering Algorithm Technical Reference(data mining)
Microsoft Clustering in SQL Server(data mining)
Tutorial: Develop a clustering model in R with SQL machine learning(machine learning service)
Perform customer clustering using R and SQL Server ML Services(machine learning service)