Hi,
Here i have a very basic and simple macro that demonstrate the use of the addColumnAttachment Method.
public void AttachColunm()
{
UIDocument uidoc = this.ActiveUIDocument;
Document doc = this.ActiveUIDocument.Document;
using (Transaction t = new Transaction(doc, "attach column to beam"))
{
t.Start();
Reference myRef = uidoc.Selection.PickObject(ObjectType.Element, "Select column");
FamilyInstance column = doc.GetElement(myRef) as FamilyInstance;
Reference myRef2= uidoc.Selection.PickObject(ObjectType.Element, "Select beam");
FamilyInstance targetBeam = doc.GetElement(myRef2) as FamilyInstance;
ColumnAttachment.AddColumnAttachment(doc, column, targetBeam, 1, ColumnAttachmentCutStyle.None,
ColumnAttachmentJustification.Minimum, 0);
t.Commit();
}
}
First select a column and then select a beam.
It's similar to the Revit end user interface 'Attach Top/Base' button from the Modify | Structural Columns Ribbon tab.

I hope this will help you for better understanding and how to implement it.